//
//  YYMineInfoVC.m
//  Project
//
//  Created by Yown on 2024/2/5.
//

#import "YYMineInfoVC.h"
#import "YYMineInfoView.h"
#import "YYMineCellModel.h"

#import <BIToolModule/NSArray+Helper.h>
#import <BIProjectModule/BIAppDefine.h>

#import <BIProjectModule/BIProjectContext.h>
#import <Masonry/Masonry.h>

@interface YYMineInfoVC ()

@property (nonatomic) YYMineInfoView *infoView;
@property (nonatomic) NSMutableArray *cellArray;

@end

@implementation YYMineInfoVC

#pragma mark - Life Cycle

+ (void)load {
    [[BIRouteManager sharedInstance] registerCMD:@"mine_info" objectOrClass:self];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupDatas];
    [self setupViews];
    [self setupLayouts];
}

- (void)setupDatas {
    NSArray *titleArray = @[@"mine_info_avatar", @"mine_info_nickname"];
    NSArray *descArray = @[@"", [BIProjectContext sharedInstance].user.phone];
    NSArray *arrowArray = @[[BIProjectContext sharedInstance].user.avatar, @"mine_arrow"];

    self.cellArray = [NSMutableArray array];
    for (NSUInteger i = 0; i < titleArray.count; i++) {
        YYMineCellModel *model = [YYMineCellModel new];
        model.title = [titleArray safeObjectAtIndex:i];
        model.desc = [descArray safeObjectAtIndex:i];
        model.arrowName = [arrowArray safeObjectAtIndex:i];
        [self.cellArray addObject:model];
    }
}

- (void)setupViews {
    self.yy_navigationItem.title = BILocalizedString(@"mine_info_title");
    self.yy_navigationBar.naviBgColor = [UIColor loadColorFromString:@"#F6F6F6"];

    self.infoView = [YYMineInfoView view];
    [self.view addSubview:self.infoView];
    [self.infoView reloadView:self.cellArray];
}

- (void)setupLayouts {
    [self.infoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(BINavigationBarHeight);
    }];
}


@end
